# eric7.UI.BrowserSortFilterProxyModel

Module implementing the browser sort filter proxy model.

### Global Attributes

None

### Classes

BrowserSortFilterProxyModel | Class implementing the browser sort filter proxy model.

### Functions

None

## BrowserSortFilterProxyModel

Class implementing the browser sort filter proxy model.

### Derived from

QSortFilterProxyModel

### Class Attributes

None

### Class Methods

None

### Methods

BrowserSortFilterProxyModel | Constructor
__remoteServerConnectionStateChanged | Private slot to handle a change of the connection state to an 'eric-ide' server.
filterAcceptsRow | Public method to filter rows.
hasChildren | Public method to check for the presence of child items.
item | Public method to get a reference to an item.
lessThan | Public method used to sort the displayed items.
preferencesChanged | Public slot called to handle a change of the preferences settings.
setShowHiddenFiles | Public method to set, whether hidden files should be shown.
sort | Public method to sort the items.

### Static Methods

None

#### BrowserSortFilterProxyModel (Constructor)

BrowserSortFilterProxyModel(parent=None, remoteServer=None)

Constructor

parent (QObject (optional))
  reference to the parent object (defaults to None)
remoteServer (EricServerInterface)
  reference to the 'eric-ide' server interface object

#### BrowserSortFilterProxyModel.__remoteServerConnectionStateChanged

__remoteServerConnectionStateChanged(connected)

Private slot to handle a change of the connection state to an 'eric-ide' server.

connected (bool)
  connection state

#### BrowserSortFilterProxyModel.filterAcceptsRow

filterAcceptsRow(source_row, source_parent)

Public method to filter rows.

It implements a filter to suppress the display of hidden files and directories (i.e. those starting with a '.') and the display of non public classes, methods and attributes. These filters are independent of each other.

source_row (int)
  row number (in the source model) of item
source_parent (QModelIndex)
  index of parent item (in the source model) of item

Return:
  flag indicating, if the item should be shown

Return Type:
  bool

#### BrowserSortFilterProxyModel.hasChildren

hasChildren(parent=None)

Public method to check for the presence of child items.

We always return True for normal items in order to do lazy population of the tree.

parent (QModelIndex)
  index of parent item

Return:
  flag indicating the presence of child items

Return Type:
  bool

#### BrowserSortFilterProxyModel.item

item(index)

Public method to get a reference to an item.

index (QModelIndex)
  index of the data to retrieve

Return:
  requested item reference

Return Type:
  BrowserItem

#### BrowserSortFilterProxyModel.lessThan

lessThan(left, right)

Public method used to sort the displayed items.

It implements a special sorting function that takes into account, if folders should be shown first, and that __init__ is always the first method of a class.

left (QModelIndex)
  index of left item
right (QModelIndex)
  index of right item

Return:
  true, if left is less than right

Return Type:
  bool

#### BrowserSortFilterProxyModel.preferencesChanged

preferencesChanged()

Public slot called to handle a change of the preferences settings.

#### BrowserSortFilterProxyModel.setShowHiddenFiles

setShowHiddenFiles(show)

Public method to set, whether hidden files should be shown.

show (bool)
  flag indicating if hidden files (i.e. those starting with '.' shall be shown

#### BrowserSortFilterProxyModel.sort

sort(column, order)

Public method to sort the items.

column (int)
  column number to sort on
order (Qt.SortOrder)
  sort order for the sort

Up